home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0039_VGA-PTR.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  61 lines

  1. {    Make a Pointer, make a Type of the data Type you are dealing with, make as
  2. many Pointers as you will need data segments (or as commonly practiced amongst
  3. the Programming elite, make an linked list of the data items), and call the
  4. GETMEM Procedure using the Pointer in the Array... Here is an example I use to
  5. copy VGA (320x200x256) screens...
  6. }
  7.  
  8. Type
  9.     ScreenSaveType = Array[0..TheSize] of Byte;
  10. Var
  11.    TheScreen                    : ScreenSaveType Absolute $A000:0000;
  12.    Screen                       : Array[1..100] of ^ScreenSaveType;
  13.  
  14. begin
  15.      InitGraphics;
  16.      Count := 0;
  17.  
  18.      Repeat
  19.            Count := Count + 1;
  20.            GetMem(Screen[Count],Sizeof(ScreenSaveType));
  21.            WriteLn('Memory at Screen ',Count,' : ',MemAvail); {THIS MAKES
  22.                                                                THE PAGES}
  23.      Until MemAvail < 70000;
  24.      For X := 1 to Count do
  25.          For A := 1 to TheSize do                   {THE MAKES A SCREEN}
  26.              Screen[X]^[A] := Random(255);
  27.      E := C;
  28.      X := 0;
  29.      GetTime(A,B,C,D);
  30.      C2 := 0;
  31.  
  32.      Repeat
  33.            X := X + 1;
  34.            GetTime(A,B,C,D);
  35.            if C <> E then
  36.               begin
  37.               C2 := C2 + 1;
  38.               testresults[C2] := X;
  39.               X := 1;
  40.               E := C;
  41.               end;
  42.      TheScreen := Screen[X mod Count + 1]^;
  43.      Move(Scroll2,Scroll1,Sizeof(Scroll2));
  44.      Until KeyPressed;
  45.      WriteLn(Test,'Number of Screens :',Count);
  46.      For X := 1 to C2 do
  47.          WriteLn(Test,'Number of flips, second #',X,':',testresults[x]);
  48.      Close(Test);
  49. end.
  50.  
  51. {    I didn't try and Compile that, I also edited out the Procedure
  52. initGraphics because you aren't Really interested in that end. However where
  53. it says "THIS MAKES THE PAGES" is what you want to do.. In this particular
  54. version I made 4 Graphics pages under pascal and 5 outside of pascal, I could
  55. have fit more but I have too many TSRS. Using Extended memory I can fit about
  56. 20 Graphics pages (I got about 2 megs ram), but you can extend that as Far as
  57. ram may go. The MOVE command isn't a bad command either to know. I got when
  58. running a Text mode, 213 Text pages per second. I was even impressed (PS
  59. Graphics people, I got 16 Graphics pages per second in 320x200x256 mode!)...
  60. }
  61.